/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.customer.manage.repository.mapper;

import info.peigen.hotpot.business.customer.core.repository.entity.PartnerEntity;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlManageMapper;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

/**
 * <b>(PartnerManageMapper)</b>
 * 管理后台 "合作伙伴" 数据库映射服务
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-09-09
 */
@SuppressWarnings("unused")
public interface PartnerManageMapper extends AbstractBeetlSqlManageMapper<PartnerEntity> {

    // 唯一索引[partner_id]
    @Sql("select * from partner where partner_id = ?")
    @Select
    PartnerEntity findByPartnerId(String partnerId);

    @Sql("select * from partner where partner_id = ? for update")
    @Select
    PartnerEntity lockByPartnerId(String partnerId);

    @Sql("delete from partner where partner_id = ?")
    @Update
    void deleteByPartnerId(String partnerId);

    // 唯一索引[partner_name]
    @Sql("select * from partner where partner_name = ?")
    @Select
    PartnerEntity findByPartnerName(String partnerName);

    @Sql("select * from partner where partner_name = ? for update")
    @Select
    PartnerEntity lockByPartnerName(String partnerName);

    @Sql("delete from partner where partner_name = ?")
    @Update
    void deleteByPartnerName(String partnerName);

    // 索引[status]
    @Sql("select * from partner where status = ?")
    @Select
    PartnerEntity findByStatus(String status);

    @Sql("delete from partner where status = ?")
    @Update
    void deleteByStatus(String status);
}